<?php

declare(strict_types=1);

namespace app\operations\validate\admin;

use sheep\validate\Backend;

class Shop extends Backend
{
    // TODO token可配置是否自动续期 默认不自动续期
    protected $rule = [
        'account' => 'require|alphaDash|length:4,12|unique:admin',
        'nickname' => 'require|chsDash|length:2,10|unique:admin',
        'mobile' => 'require|mobile|unique:admin',
        'email' => 'require|email|unique:admin',
        'password' => 'require|length:6,16',
        'role_id' => 'require|integer',
        'status' => 'require',
        'contact_name' => 'require',
        'phone' => 'require|mobile|unique:admin',
//        'shop_type' => 'require',
        'entity_type' => 'require',
        'entity_name' => 'require',
        'business_license' => 'require',
        'legal_person_name' => 'require',
        'legal_id_images' => 'require',

        'protrait_card' => 'require',
        'reverse_card' => 'require',

    ];

    protected $message  =   [
        'account.require'     => '账号必须填写',
        'account.alphaDash'     => '账号只能是字母和数字，下划线_及破折号-',
        'account.length'     => '账号长度必须在 5-12 位',
        'account.unique'     => '账号已被占用',
        'nickname.require'     => '昵称必须填写',
        'nickname.chsDash'     => '角色名称只能是汉字、字母、数字和下划线_及破折号-',
        'nickname.length'     => '昵称长度必须在 2-10 位',
        'nickname.unique'     => '昵称已被占用',
        'mobile.require'     => '手机号不能为空',
        'mobile.mobile'     => '手机号格式不正确',
        'mobile.unique'     => '手机号已被占用',
        'email.require'     => '邮箱不能为空',
        'email.email'     => '邮箱格式不正确',
        'email.unique'     => '邮箱已被占用',
        'password.require'     => '密码必须填写',
        'password.length'     => '密码长度必须在 6-16 位',
        'role_id.require'     => '必须选择所属角色',
        'role_id.integer'     => '所属角色格式不正确',
        'status.require'     => '状态必须选择',
        'contact_name.require'     => '联系人必须填写',
        'phone.require'     => '联系电话不能为空',
        'phone.mobile'     => '联系电话格式不正确',
        'phone.unique'     => '联系电话已被占用',
        'shop_type.require'     => '店铺类型必须选择',
        'entity_type.require'     => '主体类型不能为空',
        'entity_name.require'     => '主体名称不能为空',
        'business_license.require'     => '营业执照必须上传',
        'legal_person_name.require'     => '法人名称不能为空',
        'protrait_card.require'     => '法人人像照照片不能为空',
        'reverse_card.require'     => '法人国徽照片不能为空'
    ];


    protected $scene = [
        'add'  =>  ['account', 'mobile','password', 'email','status','contact_name','phone','entity_type','entity_name','business_license','legal_person_name','protrait_card','reverse_card'],
    ];
}
